<% drag_id=model_to_drag_id @person %>
<div class="tabber" id="persontab">
  <div id="person_tab" class="tabbertab listings_blank" title="<%= mine?(@person)? "Your details" : @person.name.pluralize + " details" -%>">
    <h3>
      <% if mine?(@person) -%>
        Me
      <% else -%>
        <%= "#{@person.name}" -%>

      <% end %>
    </h3>
<%#*<h1>%>
<%#= h @person.name -%>
<%#*</h1>%>

    <div class="show_basic">

      <div class="main_content_left_box">
        <div class="box_about_actor">

          <p>
            <b>Name:</b> <%= h @person.name %>
          </p>

          <% if mine?(@person) -%>
            <!-- <p>
              <b>Login name :</b>  -->
<%#= h @person.user.login %> 
<!-- <span class='none_text'>(Only visible to you)</span>
            </p> -->
			<!-- <p> -->
              <!-- <b>UKDA REGISTERED :</b> -->
 <%#= h ukda_registration_check(@person) ? "yes" : "No" %>
            <!-- </p> -->

  <%#*<p>%>
  <%#*<b>ID :</b>%>
  <%#= @person.id %>
  <%#*<span class='none_text'>(Only visible to you)</span>%>
  <%#*</p>%>
          <% end -%>




          <!--<p>
        <b>Disciplines:</b> <%#= discipline_list(@person) %>
      </p>-->

          <p>
            <%= render :partial=>"areas_of_expertise", :locals => {:person=>@person}  %>
          </p>

          <p>
            <% if mine?(@person) || @person.can_be_edited_by?(current_user) -%>
            <ul class="sectionIcons" style="text-align:left;">
              <li><%= icon('edit', edit_person_path(@person), "Edit Person Profile", nil, 'Edit Profile') -%></li>

              <% if mine?(@person) -%>
                <li>
                  <%= icon "lock", url_for({:controller=>:users, :action=>:edit, :id=>@person.user}), "Change password", nil, "Change password" -%>
                </li>
              <% end -%>

              <% if current_user.is_admin? || mine?(@person) -%>
<% if mine?(@person) -%>
                <li><%= icon "destroy", person_path(@person), "Suspend your account", { :confirm => 'This will hide your personal information and make all your data aanonymous! Are you sure?', :method => :delete }, "Suspend your account" -%>
                </li>
	<% else -%>
	 <li><%= icon "destroy", person_path(@person), "Suspend account", { :confirm => "This will hide the user's personal information and make all their data aanonymous! Are you sure??", :method => :delete }, "Suspend Person" -%>
        </li>
	<% end -%>

              <% end -%>
            </ul>
          <% end %>
          </p>
        </div>

      </div>




      <div class="main_content_right_box">
        <%= render :partial => "layouts/contribution_section_box_avatar", :locals => { :object => @person, :drag_id => drag_id } -%>
      </div>

      <div style="clear:both;">
        <br/>
        <hr/>

        <p>
          <b>About me:</b>
        <div id="description" class="box_standout" style="background-color:#FFFFFF;">
          <%= text_or_not_specified(@person.description, :description=>true) %>
        </div>
        </p>

        <br/>

        <%= render :partial=>"people/contact_details" %>

<%#= render :partial=>"people/roles",:locals=>{:editable=>false} %>

<%# get, classify and authorize all assets for this person's user (assets belong to users, not people!) -%>
        <% persons_asset_hash = (@person.user ? Asset.classify_and_authorize(@person.user.assets, true, current_user) : {}) -%>
<% persons_asset_hash.each_key {|key| persons_asset_hash[key].sort!{|x,y| y.created_at <=> x.created_at}}%>
<%# persons_asset_hash.merge!(classify_for_tabs(@person.projects)) %>
<%# persons_asset_hash.merge!(classify_for_tabs(@person.institutions)) %>
        <%# persons_asset_hash.merge!(classify_for_tabs(@person.csvarchives)) %>
<%#= render :partial=>"layouts/items_related_to",:locals=>{:item_name=>@person.name,:item_hash=>persons_asset_hash} %>

      </div>

    </div>
  </div>
<% if mine?(@person) -%>
<div id="person_tab" class="tabbertab " title="Searches for surveys with details of times and variables" -%>
    <h3>
        My Searches
    </h3>
<div>
	<%= render :partial => "search/previous_searches" -%>
</div>
</div>
<% end %>
 
 <% unless persons_asset_hash.empty? -%>
    <% persons_asset_hash.each_key do |resource_type| -%>
      <% visible_resource_type = resource_type.titleize.pluralize -%>
      <% visible_resource_type = "Data Extracts" if visible_resource_type=="Csvarchives" %>
      <% visible_resource_type = "Methods and Scripts" if visible_resource_type=="Scripts" %>
      <% unless (resources = persons_asset_hash[resource_type]).nil? || resources.empty? -%>
        <div id="<%= resource_type.downcase.pluralize -%>" class="tabbertab listings_blank" title="<%= mine?(@person)? "All of your " + visible_resource_type : @person.name.pluralize + " public " + visible_resource_type -%>">
          <h3>	 <% if mine?(@person) -%>
		        My
		      <% else -%>
		        <%= "#{@person.first_name.pluralize}" -%>

		      <% end %> <%= "#{visible_resource_type} (#{resources.length})" -%></h3>
          <%= render :partial => "assets/resource_list", :locals => { :collection => resources, :narrow_view => true, :authorization_for_showing_already_done => true } -%>
        </div>
      <% end -%>
    <% end -%>
  <% end -%>
</div>